import type { App } from 'vue'
import { defineAsyncComponent } from 'vue'
import AppGenerator from './index/Home.vue'
const tempsModules = import.meta.glob('generator/components/temps/**/*.vue')

import './static/css/index.css'
import './lib/animate/index.css'

const comps = [
  {
    name: 'AppGenerator',
    component: AppGenerator
  }
]

export default function (app: App) {
  for(let key in tempsModules) {
    if(key.endsWith('index.vue')) {
      app.component((key.split('/').at(-2) + 'Temp') as string, defineAsyncComponent<any>(tempsModules[key]))
    }
  }
  for (const comp of comps) {
    app.component(comp.name, comp.component)
  }
}
